package com.baidu.health.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * 商品信息表-孙新超
 * @TableName tb_goods
 */
@TableName(value ="tb_goods")
@Data
@Document(indexName = "tb_goods")
public class TbGoods implements Serializable {
    /**
     * 商品编号
     */
    @Id
    @TableId(type = IdType.AUTO)
    private Integer goodsId;

    /**
     * 商品名称
     */
    @Field(index = true,type = FieldType.Text,searchAnalyzer = "ik_max_word",analyzer = "ik_max_word")
    private String goodsName;

    /**
     * 商品库存
     */
    @Field(index = true,type = FieldType.Integer)
    private Integer goodsStock;

    /**
     * 商品状态
     */
    @Field(index = true,type = FieldType.Integer)
    private Integer goodsState;

    /**
     * 商品现有数量
     */
    @Field(index = true,type = FieldType.Text)
    private String goodsQuantity;

    /**
     * 商品增量时间字段
     */
    @Field(index = true,type = FieldType.Text)
    private String goodsUpdatetime;

    /**
     * 假删除
     */
    @Field(index = true,type = FieldType.Byte)
    private Byte deleted;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
//    @Field(index = true,type = FieldType.Date)
    private Date createTime;

    /**
     * 最后修改的时间
     */
//    @Field(index = true,type = FieldType.Date)
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 商家id
     * */
    private Integer storeId;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}